﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="Microsoft.Wpf.Samples.CustomUIOne.MainWindow"
    Title="Custom UI One"
    Height="350"
    Width="525"
    WindowStyle="None"
    Background="{x:Null}"
    Foreground="White"
    WindowStartupLocation="CenterScreen"
    AllowsTransparency="False">
    <Window.Resources>
        <Style
            x:Key="ButtonFocusVisual">
            <Setter
                Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Rectangle
                            Margin="2"
                            SnapsToDevicePixels="true"
                            Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                            StrokeThickness="1"
                            StrokeDashArray="1 2" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <LinearGradientBrush
            x:Key="ButtonNormalBackground"
            EndPoint="0,1"
            StartPoint="0,0">
            <GradientStop
                Color="#F3F3F3"
                Offset="0" />
            <GradientStop
                Color="#EBEBEB"
                Offset="0.5" />
            <GradientStop
                Color="#DDDDDD"
                Offset="0.5" />
            <GradientStop
                Color="#CDCDCD"
                Offset="1" />
        </LinearGradientBrush>
        <SolidColorBrush
            x:Key="ButtonNormalBorder"
            Color="#FF707070" />
        <Style
            x:Key="CloseButtonStyle"
            TargetType="{x:Type Button}">
            <Setter
                Property="FocusVisualStyle"
                Value="{StaticResource ButtonFocusVisual}" />
            <Setter
                Property="Background"
                Value="{StaticResource ButtonNormalBackground}" />
            <Setter
                Property="BorderBrush"
                Value="{StaticResource ButtonNormalBorder}" />
            <Setter
                Property="BorderThickness"
                Value="1" />
            <Setter
                Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
            <Setter
                Property="HorizontalContentAlignment"
                Value="Center" />
            <Setter
                Property="VerticalContentAlignment"
                Value="Center" />
            <Setter
                Property="Padding"
                Value="1" />
            <Setter
                Property="Template">
                <Setter.Value>
                    <ControlTemplate
                        TargetType="{x:Type Button}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="0.498*" />
                                <RowDefinition
                                    Height="0.502*" />
                            </Grid.RowDefinitions>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup
                                    x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition
                                            GeneratedDuration="0:0:0.4" />
                                    </VisualStateGroup.Transitions>
                                    <VisualState
                                        x:Name="Normal" />
                                    <VisualState
                                        x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                Storyboard.TargetName="ellipse">
                                                <EasingColorKeyFrame
                                                    KeyTime="0"
                                                    Value="#FF0030F1" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState
                                        x:Name="Pressed">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                                Storyboard.TargetName="ellipse">
                                                <EasingColorKeyFrame
                                                    KeyTime="0"
                                                    Value="#FF350000" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState
                                        x:Name="Disabled" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Ellipse
                                x:Name="ellipse"
                                Grid.RowSpan="2" StrokeThickness="2">
                            	<Ellipse.Stroke>
                            		<LinearGradientBrush EndPoint="0.853,0.854" StartPoint="0.147,0.146">
                            			<GradientStop Color="Black" Offset="0"/>
                            			<GradientStop Color="#FF979797" Offset="1"/>
                            		</LinearGradientBrush>
                            	</Ellipse.Stroke>
                                <Ellipse.Fill>
                                    <RadialGradientBrush
                                        GradientOrigin="0.496,0.953">
                                        <GradientStop
                                            Color="#FFF10000"
                                            Offset="1" />
                                        <GradientStop
                                            Color="#FFFFD4D4" />
                                    </RadialGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Path
                                Data="M74.5,37.5 C74.5,57.934536 58.434536,32 38,32 17.565464,32 0.5,57.934536 0.5,37.5 0.5,17.065464 17.065464,0.5 37.5,0.5 57.934536,0.5 74.5,17.065464 74.5,37.5 z"
                                Stretch="Fill"
                                Stroke="{x:Null}"
                                Margin="0,0,0,-8.462">
                                <Path.Fill>
                                    <LinearGradientBrush
                                        EndPoint="0.5,1"
                                        MappingMode="RelativeToBoundingBox"
                                        StartPoint="0.5,0">
                                        <GradientStop
                                            Color="White" />
                                        <GradientStop
                                            Offset="1" />
                                    </LinearGradientBrush>
                                </Path.Fill>
                            </Path>
                            <ContentPresenter
                                Grid.RowSpan="2"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger
                                Property="IsKeyboardFocused"
                                Value="true" />
                            <Trigger
                                Property="ToggleButton.IsChecked"
                                Value="true" />
                            <Trigger
                                Property="IsEnabled"
                                Value="false">
                                <Setter
                                    Property="Foreground"
                                    Value="#ADADAD" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="CloseButton" TargetType="{x:Type Button}">
        	<Grid>
        		<VisualStateManager.VisualStateGroups>
        			<VisualStateGroup x:Name="CommonStates">
        				<VisualStateGroup.Transitions>
        					<VisualTransition GeneratedDuration="0:0:0.5"/>
        				</VisualStateGroup.Transitions>
        				<VisualState x:Name="Normal"/>
        				<VisualState x:Name="MouseOver">
        					<Storyboard>
        						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
        							<EasingColorKeyFrame KeyTime="0" Value="Red"/>
        						</ColorAnimationUsingKeyFrames>
        					</Storyboard>
        				</VisualState>
        				<VisualState x:Name="Pressed">
        					<Storyboard>
        						<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
        							<EasingColorKeyFrame KeyTime="0" Value="#FFFF0A0A"/>
        						</ColorAnimationUsingKeyFrames>
        					</Storyboard>
        				</VisualState>
        				<VisualState x:Name="Disabled"/>
        			</VisualStateGroup>
        		</VisualStateManager.VisualStateGroups>
        		<Rectangle x:Name="rectangle" Height="Auto" Margin="0" Stroke="White" VerticalAlignment="Stretch" StrokeThickness="2">
        			<Rectangle.Fill>
        				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        					<GradientStop Color="Black" Offset="0"/>
        					<GradientStop Color="#FF787878" Offset="1"/>
        				</LinearGradientBrush>
        			</Rectangle.Fill>
        		</Rectangle>
        		<ContentPresenter Margin="10,8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        	</Grid>
        </ControlTemplate>
        <LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
        	<GradientStop Color="#ABADB3" Offset="0.05"/>
        	<GradientStop Color="#E2E3EA" Offset="0.07"/>
        	<GradientStop Color="#E3E9EF" Offset="1"/>
        </LinearGradientBrush>
        <Style x:Key="TextBoxStyle1" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
        	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        	<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        	<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}"/>
        	<Setter Property="BorderThickness" Value="1"/>
        	<Setter Property="Padding" Value="1"/>
        	<Setter Property="AllowDrop" Value="true"/>
        	<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        	<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        	<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="{x:Type TextBox}">
        				<Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="true">
        					<ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
        				</Microsoft_Windows_Themes:ListBoxChrome>
        				<ControlTemplate.Triggers>
        					<Trigger Property="IsEnabled" Value="false">
        						<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        						<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
        					</Trigger>
        				</ControlTemplate.Triggers>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition
                Height="88" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Button
            x:Name="CloseButton"
            HorizontalAlignment="Right"
            Width="40"
            Margin="0,16,16,0"
            Style="{DynamicResource CloseButtonStyle}"
            Click="CloseButton_Click" Height="40" VerticalAlignment="Top" >
        	<Grid Height="35.47" Width="15.73">
        		<TextBlock TextWrapping="Wrap" Text="X" FontSize="26.667" Foreground="Black" d:LayoutOverrides="Width, Height"/>
        		<TextBlock TextWrapping="Wrap" Text="X" FontSize="26.667" Foreground="White" d:LayoutOverrides="Width, Height" Margin="-1,-2,1,2"/>
        	</Grid>
        </Button>
        <TextBlock
            HorizontalAlignment="Left"
            TextWrapping="Wrap"
            VerticalAlignment="Center"
            Margin="16,0,0,0"
            FontSize="64"
            FontWeight="Bold"><TextBlock.Effect>
    			<DropShadowEffect
                    BlurRadius="5" />
    		</TextBlock.Effect><Run
                Text="Login" /></TextBlock>
        <Grid
            Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="0.4*" />
                <RowDefinition
                    Height="0.4*" />
                <RowDefinition
                    Height="0.279*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition
                    Width="0.346*" />
                <ColumnDefinition
                    Width="0.654*" />
            </Grid.ColumnDefinitions>
            <TextBlock
                TextWrapping="Wrap"
                FontSize="29.333"
                Margin="24,0,3.228,0"
                VerticalAlignment="Center"
                Text="User">
    			<TextBlock.Effect>
    				<DropShadowEffect />
    			</TextBlock.Effect>
            </TextBlock>
            <TextBlock
                TextWrapping="Wrap"
                Grid.Row="1"
                FontSize="29.333"
                Margin="24,0,0.114,0"
                VerticalAlignment="Center">
    			<TextBlock.Effect>
    				<DropShadowEffect />
    			</TextBlock.Effect><Run
                    Text="Pas" /><Run
                    Text="sword" /></TextBlock>
            <Border
            	Grid.Column="1"
            	Margin="8"
            	Grid.Row="1" Background="#BFFFFFFF" BorderBrush="#BFFFFFFF" BorderThickness="4" CornerRadius="8"
                >
            	<PasswordBox
            		FontSize="42.667"
            		FontStyle="Italic" Background="{x:Null}" BorderBrush="{x:Null}" />
            </Border>
            <Border Grid.Column="1" Margin="8" BorderThickness="4" CornerRadius="8" BorderBrush="#BFFFFFFF" Background="#BFFFFFFF">
            	<TextBox
            		TextWrapping="Wrap"
            		Text="Oliver"
            		FontSize="42.667"
            		FontStyle="Italic" Background="{x:Null}" Style="{DynamicResource TextBoxStyle1}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" />
            </Border>
            <Button
                x:Name="LoginButton"
                Content="OK"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Margin="0"
                Grid.Row="2"
                Width="112"
                FontSize="26.667"
                VerticalAlignment="Center"
                Click="LoginButton_Click" Template="{DynamicResource CloseButton}" Foreground="White" />

        </Grid>

    </Grid>
</Window>
